#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

int main() {
    int arr[100][100] = { 0 };
    int a, b, flag;
    scanf("%d", &a);
    for (int c = 0; c < a; c++)
    {
        for (int y = 0; y < a; y++)
        {
            scanf("%d ", &arr[c][y]);
        }
    }
    for (int c = 0; c < a; c++)
    {
        for (int y = 0; y < a; y++)
        {
            if (c > y && arr[c][y] != 0)
            {
                flag = 0; break;
            }
            else flag = 1;
        }

    }
    if (flag)
        printf("YES");
    else printf("NO");

}